'use strict';  
  
/* Services- 将请求的结果进行缓存 */
app.service('userTrackService',['ajaxService', function (ajaxService) {
	this.path = './';
	
	this.setPvLog = function (params) {       
		this.setPv(params,this.setCompleted,this.setError);           
    };
    this.setClickLog = function (params) {       
		this.setClick(params,this.setCompleted,this.setError);           
    };
    
    this.setCompleted = function(response) {
		var data = response.result;
		if(data!='ok') {
			console.log(data);
		}
	}
    this.setError = function(response) {
		console.log(response.code);
	}
	// private
	this.setPv = function (params, successFunction, errorFunction) {       
        //ajaxService.AjaxPost(params, this.path+'api/usertrack/setPv.do', successFunction, errorFunction);
		ajaxService.AjaxGetWithData(params, this.path+'api/usertrack/setPv.do', successFunction, errorFunction);
		
	};
    
    this.setClick = function (params, successFunction, errorFunction) {       
        ajaxService.AjaxPost(params, this.path+"api/usertrack/setClick.do", successFunction, errorFunction);           
    };
}]);
